package com.ktgj.service.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ktgj.common.log.annotation.Log;
import com.ktgj.common.log.enums.BusinessType;
import com.ktgj.common.security.annotation.PreAuthorize;
import com.ktgj.service.domain.ContractLinkAirportservicePricelog;
import com.ktgj.service.service.IContractLinkAirportservicePricelogService;
import com.ktgj.common.core.web.controller.BaseController;
import com.ktgj.common.core.web.domain.AjaxResult;
import com.ktgj.common.core.utils.poi.ExcelUtil;
import com.ktgj.common.core.web.page.TableDataInfo;

/**
 * 合同机场服务价格记录Controller
 * 
 * @author ruoyi
 * @date 2021-09-03
 */
@ControllerAdvice
@RestController
@RequestMapping("/pricelog")
public class ContractLinkAirportservicePricelogController extends BaseController
{
    @Autowired
    private IContractLinkAirportservicePricelogService contractLinkAirportservicePricelogService;

    /**
     * 查询合同机场服务价格记录列表
     */
    @PreAuthorize(hasPermi = "service:pricelog:list")
    @GetMapping("/list")
    public TableDataInfo list(ContractLinkAirportservicePricelog contractLinkAirportservicePricelog)
    {
        startPage();
        List<ContractLinkAirportservicePricelog> list = contractLinkAirportservicePricelogService.selectContractLinkAirportservicePricelogList(contractLinkAirportservicePricelog);
        return getDataTable(list);
    }

    /**
     * 导出合同机场服务价格记录列表
     */
    @PreAuthorize(hasPermi = "service:pricelog:export")
    @Log(title = "合同机场服务价格记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ContractLinkAirportservicePricelog contractLinkAirportservicePricelog) throws IOException
    {
        List<ContractLinkAirportservicePricelog> list = contractLinkAirportservicePricelogService.selectContractLinkAirportservicePricelogList(contractLinkAirportservicePricelog);
        ExcelUtil<ContractLinkAirportservicePricelog> util = new ExcelUtil<ContractLinkAirportservicePricelog>(ContractLinkAirportservicePricelog.class);
        util.exportExcel(response, list, "合同机场服务价格记录数据");
    }

    /**
     * 获取合同机场服务价格记录详细信息
     */
    @PreAuthorize(hasPermi = "service:pricelog:query")
    @GetMapping(value = "/{operationlogId}")
    public AjaxResult getInfo(@PathVariable("operationlogId") Long operationlogId)
    {
        return AjaxResult.success(contractLinkAirportservicePricelogService.selectContractLinkAirportservicePricelogById(operationlogId));
    }

    /**
     * 新增合同机场服务价格记录*/
    @PreAuthorize(hasPermi = "service:pricelog:add")
    @Log(title = "合同机场服务价格记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ContractLinkAirportservicePricelog contractLinkAirportservicePricelog)
    {
        return toAjax(contractLinkAirportservicePricelogService.insertContractLinkAirportservicePricelog(contractLinkAirportservicePricelog));
    }

    /**
     * 修改合同机场服务价格记录*/
    @PreAuthorize(hasPermi = "service:pricelog:edit")
    @Log(title = "合同机场服务价格记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ContractLinkAirportservicePricelog contractLinkAirportservicePricelog)
    {
        return toAjax(contractLinkAirportservicePricelogService.updateContractLinkAirportservicePricelog(contractLinkAirportservicePricelog));
    }

    /**
     * 删除合同机场服务价格记录*/
    @PreAuthorize(hasPermi = "service:pricelog:remove")
    @Log(title = "合同机场服务价格记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{operationlogIds}")
    public AjaxResult remove(@PathVariable Long[] operationlogIds)
    {
        return toAjax(contractLinkAirportservicePricelogService.deleteContractLinkAirportservicePricelogByIds(operationlogIds));
    }
}
